<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/8/8
 * Time: 14:21
 */
namespace app\basketball\controller;

use app\basketball\model\UserFeedback;
use app\basketball\model\Userinfo;

class User extends BassController{

    //用户列表
    public function user_list(){
        $username = request()->post('username');
        $where = '';
        if(!empty($username)){
            $where['username'] = $username;
        }
        //查询用户列表
        $user_list = Userinfo::where($where)->paginate(10);
        foreach ($user_list as $k=>$v){
            $v['lastlogin_time'] = date('Y-m-d H:i:s',$v['lastlogin_time']);
            $v['reg_time'] = date('Y-m-d H:i:s',$v['reg_time']);
        }
        return view('',['user_list'=>$user_list,'username'=>$username]);
    }


    //意见反馈列表
    public function feedback_list(){
        $username = request()->post('username');
        $where = '';
        if(!empty($username)){
            $uid = Userinfo::where('username',$username)->value('id');
            $where['id'] = $uid;
        }
        $list = UserFeedback::where('status',1)->where($where)->paginate(10);
        foreach ($list as $k=>$v){
            $v['username'] = Userinfo::where('id',$v['uid'])->value('username');
        }
        return view('',['list'=>$list,'username'=>$username]);
    }


}